package net.tarine.gastronomi.server.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.jdo.annotations.Element;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.Index;
import javax.jdo.annotations.Order;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.gwt.user.client.rpc.IsSerializable;

@PersistenceCapable(detachable = "true")
public class ForumThread implements IsSerializable, Serializable {
	private static final long serialVersionUID = 427355427654460001L;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String id;
	@Persistent
	private Gas gas;
	@Persistent
	private String title;
	@Persistent
	private String gasUserId;
	@Persistent
	@Index
	private Date creationDt;
	@Persistent
	private Date modifiedDt;
	@Persistent
	private Date lastMessageDt;
	@Persistent(mappedBy = "forumThread")
	@Order(extensions = @Extension(vendorName = "datanucleus", key = "list-ordering", value = "modifiedDt asc"))
	@Element(dependent = "true")
	private List<ForumMessage> forumMessageList;
	@Persistent
	private List<String> subscribedUserIdList;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Gas getGas() {
		return gas;
	}

	public void setGas(Gas gas) {
		this.gas = gas;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getGasUserId() {
		return gasUserId;
	}

	public void setGasUserId(String gasUserId) {
		this.gasUserId = gasUserId;
	}

	public Date getCreationDt() {
		return creationDt;
	}

	public void setCreationDt(Date creationDt) {
		this.creationDt = creationDt;
	}

	public Date getModifiedDt() {
		return modifiedDt;
	}

	public void setModifiedDt(Date modifiedDt) {
		this.modifiedDt = modifiedDt;
	}

	public Date getLastMessageDt() {
		return lastMessageDt;
	}

	public void setLastMessageDt(Date lastMessageDt) {
		this.lastMessageDt = lastMessageDt;
	}

	public List<ForumMessage> getForumMessageList() {
		return forumMessageList;
	}

	public void setForumMessageList(List<ForumMessage> forumMessageList) {
		this.forumMessageList = forumMessageList;
	}

	public List<String> getSubscribedUserIdList() {
		return subscribedUserIdList;
	}

	public void setSubscribedUserIdList(List<String> subscribedUserIdList) {
		this.subscribedUserIdList = subscribedUserIdList;
	}

}
